import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import routes from './routes.js';
import config from './config.js';
import App from './app.vue';
Vue.use(VueRouter);
Vue.use(routes);

const api = axios.create({
    baseURL: config.API_URL,
    timeout: 30000,
});
Vue.prototype.api           =   api;

const router    =   new VueRouter({
    mode: 'hash',
    base:__dirname,
    linkActiveClass: 'active',
    routes: routes
});

document.setTitle = function(t) {
    document.title = t;
    var i = document.createElement('iframe');
    i.src = '//m.baidu.com/favicon.ico';
    i.style.display = 'none';
    i.onload = function() {
        setTimeout(function(){
            i.remove();
        }, 9);
    }
    document.body.appendChild(i);
}

const app = new Vue({
    el:'#app',
    router,
    render: h => h(App),
    created:function (){
        this.init();
    },
    methods:{
        init:function () {

        }
    }

});